<!doctype html>
<html><head>
<meta charset="utf-8">
<title>4chan X</title>
<link rel="stylesheet" href="web.css">
<link rel="icon" href="img/icon.gif">
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/ohnjgmpcibpbafdlkimncjhflgedgpam">
</head><body>
<div id="header">
<h1 id="4chan-x">4chan X</h1>
<div id="links">
<a href="https://github.com/ccd0/4chan-x">Source Code</a>
<a href="https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md">Changelog</a>
<a href="https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions">FAQ</a>
<a href="https://github.com/ccd0/4chan-x/wiki/Privacy">Privacy</a>
<a href="https://github.com/ccd0/4chan-x/issues">Report Bugs</a>
</div>
</div>
<a class="screenshot" href="img/screenshot.png"><img src="img/screenshot.png" alt="Screenshot"></a>
<%=
content
  .match(/<\/h1>([^]*)<h2 id="more-information"/)[1]
  .replace(
    /(<h3 id="(.*?)">)(.*?)(<\/h3>[^]*?)(?=<h)/g,
    '<input hidden type="checkbox" id="$2-hide"><div>$1<label for="$2-hide">$3</label>$4</div>'
  )
%>
<script>
function imagePreview() {
  this.removeEventListener('mouseover', imagePreview, false);
  var img = new Image();
  img.src = this.href;
  img.alt = 'preview';
  var span = document.createElement('span');
  span.className = 'hover';
  span.appendChild(img);
  this.parentNode.insertBefore(span, this.nextSibling);
}
function storeInstall(e) {
  if (!e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey && e.button === 0) {
    var url = this.href;
    chrome.webstore.install(url, function(){}, function(){
      location.href = url;
    });
    e.preventDefault();
  }
}
for (var i = 0; i < document.links.length; i++) {
  var link = document.links[i];
  if (/\.png$/.test(link.pathname) && !link.querySelector('.hover')) {
    link.addEventListener('mouseover', imagePreview, false);
  } else if (window.chrome && link.host === 'chrome.google.com') {
    link.addEventListener('click', storeInstall, false);
  }
}
var engine = (function() {
  if (/Edge\//.test(navigator.userAgent)) return 'edge';
  if (/Chrome\//.test(navigator.userAgent)) return 'blink';
  if (/WebKit\//.test(navigator.userAgent)) return 'webkit';
  if (/Gecko\/|Goanna/.test(navigator.userAgent)) return 'gecko';
  if (/Presto\//.test(navigator.userAgent)) return 'presto';
})();
var engines = {'firefox': 'gecko', 'chromium': 'blink presto', 'safari': 'webkit', 'webkitgtk-qtwebkit-qtwebengine': 'webkit', 'ms-edge': 'edge', 'other-browsers': ''};
if (location.hash.slice(1) in engines) {
  for (browser in engines) {
    document.getElementById(browser + '-hide').checked = (browser !== location.hash.slice(1));
  }
} else if (engine) {
  for (browser in engines) {
    document.getElementById(browser + '-hide').checked = (engines[browser].indexOf(engine) < 0);
  }
}
</script>
</body></html>
